﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="quan_tri_nhom_san_pham.ascx.cs" Inherits="Admin_Module_quan_tri_nhom_san_pham" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


<telerik:RadAjaxManager OnAjaxRequest="Ajax_Request" ID="RadAjaxManager1" runat="server" 
    DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
       <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdPage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grdPage">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                <telerik:AjaxUpdatedControl ControlID="grdPage" />
                <telerik:AjaxUpdatedControl ControlID="lblMessage" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>

<telerik:RadScriptBlock runat="server" ID="script1">
    <script type="text/javascript" language="javascript">
        function Window_Close() {
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }
    </script>
</telerik:RadScriptBlock>

<telerik:RadWindowManager  ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow OnClientClose="Window_Close" Skin="WebBlue" VisibleStatusbar="false" Width="100%" Height="100%" runat="server" ID="windows1"></telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

<asp:Label runat="server" ID="lblMessage"></asp:Label>

<div style="width:100%; border:solid 1px #ccc">
    <table width="100%">
        <tr>
            <td style="width:80%"> <span class="title">QUẢN TRỊ NHÓM SẢN PHẨM</span></td>
            <td align="right"><a href="/Admin/Form/ProductCategory_Add.aspx" >Thêm Mới</a></td>
        </tr>
    </table>
</div>



<telerik:RadGrid OnDeleteCommand="Page_Delete" Skin="WebBlue" GridLines="Horizontal"  AllowPaging="true" PageSize="10" runat="server" ID="grdPage" AutoGenerateColumns="false"
     DataSourceID="SqlDataSource1">
    <MasterTableView DataKeyNames="FunctionPageID" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource1" >
        <DetailTables >
            <telerik:GridTableView AutoGenerateColumns="false" DataSourceID="SqlDataSource2" DataKeyNames="FunctionPageID">
                <ParentTableRelation>
                    <telerik:GridRelationFields MasterKeyField="FunctionPageID" DetailKeyField="ParentID" />
                </ParentTableRelation>
                <Columns>
                    <telerik:GridBoundColumn HeaderText="ID" Display="false" DataField="FunctionPageID"></telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn AutoPostBackOnFilter="true" AllowFiltering="true" HeaderText="Tên Nhóm" UniqueName="FunctionPageName" DataField="FunctionPageName">                
                        <ItemTemplate>
                            <a href="/Admin/Form/ProductCategory_Add.aspx?id=<%#DataBinder.Eval(Container.DataItem,"FunctionPageID")%>">
                            <%# Eval("FunctionPageName")%></a>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="FunctionPageTitle" HeaderText="Tiêu đề trang nhóm"></telerik:GridBoundColumn>
                    <telerik:GridImageColumn DataImageUrlFields="FunctionPageImage" ImageHeight="100" ImageWidth="120" HeaderText="Ảnh nhóm"></telerik:GridImageColumn>
                    <telerik:GridBoundColumn DataField="ViewOrder" HeaderText="Thứ tự hiển thị"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn CommandName="Delete" UniqueName="DeleteColumn" ButtonType="ImageButton" ConfirmText="Bạn có chắc chắn muốn xóa trang nhóm?"  ImageUrl="/Image/delete.png"></telerik:GridButtonColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>

        <ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>
        <Columns>
        <telerik:GridBoundColumn HeaderText="ID" Display="false" DataField="FunctionPageID"></telerik:GridBoundColumn>
            <telerik:GridTemplateColumn AutoPostBackOnFilter="true" AllowFiltering="true" HeaderText="Tên Nhóm" DataField="FunctionPageName">                
                        <ItemTemplate>
                            <a href="#" onclick="openRadWindow('/Admin/Form/ProductCategory_Add.aspx?id=<%#DataBinder.Eval(Container.DataItem,"FunctionPageID")%>', 'windows1');">
                            <%# Eval("FunctionPageName")%></a>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="FunctionPageTitle" HeaderText="Tiêu đề trang nhóm"></telerik:GridBoundColumn>
            <telerik:GridImageColumn DataImageUrlFields="FunctionPageImage" ImageHeight="100" ImageWidth="120" HeaderText="Ảnh nhóm"></telerik:GridImageColumn>
            <telerik:GridBoundColumn DataField="ViewOrder" HeaderText="Thứ tự hiển thị"></telerik:GridBoundColumn>
            <telerik:GridButtonColumn CommandName="Delete" UniqueName="DeleteColumn" ButtonType="ImageButton" ConfirmText="Bạn có chắc chắn muốn xóa trang nhóm?"  ImageUrl="/Image/delete.png"></telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>




<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
     SelectCommandType="StoredProcedure"  
    SelectCommand="CategoryPage_GetByParentId">
    <SelectParameters>
        <asp:Parameter Name="ParentID" DefaultValue="4,139" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>
    
<asp:SqlDataSource ID="SqlDataSource2"
    ProviderName="System.Data.SqlClient" SelectCommandType="StoredProcedure" SelectCommand="CategoryPage_GetByParentId"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="ParentID" SessionField="FunctionPageID" Type="string" />
    </SelectParameters>
</asp:SqlDataSource>



